#ifndef AVALON_SIGNALHANDLING_HPP
#define AVALON_SIGNALHANDLING_HPP
#include <boost/preprocessor/iteration/local.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/repeat.hpp>
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
#include "Avalon/Base/Functional.hpp"

#define AVALON_SIGNAL_HANDLING_PARAMETER_COUNT 10

namespace Avalon {
namespace SignalHandling {
  class ConnectionGroup;
  class GroupConnection;
  class QueuedSignalHandler;
  class ScopedGroupConnection;
  class SignalSink;
  class TaskSignalHandler;

  /*! \struct NullSlot
   *  \brief Defines a slot that does nothing.
   */
  template<typename Signal, int Arity = boost::function_traits<Signal>::arity>
  struct NullSlot {};

  #define NULL_SLOT_TYPES(z, n, a)                                             \
    BOOST_PP_COMMA_IF(n)                                                       \
    typename boost::function_traits<Signal>::arg##a##_type

  #define BOOST_PP_LOCAL_MACRO(n)                                              \
  template<typename Signal>                                                    \
  struct NullSlot<Signal, n> {                                                 \
    static void Slot(BOOST_PP_REPEAT(n, NULL_SLOT_TYPES, n)) {}                \
  };

  #define BOOST_PP_LOCAL_LIMITS (0, AVALON_SIGNAL_HANDLING_PARAMETER_COUNT)
    #include BOOST_PP_LOCAL_ITERATE()
  #undef NULL_SLOT_TYPES
}
}

#endif // AVALON_SIGNALHANDLING_HPP
